import { useState,useContext } from 'preact/hooks'
import {route} from 'preact-router';
import {AuthContext} from '@/contexts/authContext';

export function MedalwallRules(data) {
  let [name,setName] = useState('规则说明');
  console.log('data---------',data);
  let {loginOut} = useContext<any>(AuthContext);
  const onGoPage=()=>{
    route('/member/medalwall/home',true);
  }

  const onLoginOut=()=>{
    loginOut().then((res:any)=>{
     if(res){
      console.log('退出登陆成功！');
      route('/login',true);
     }   
    }).catch((err:any)=>{
      console.log('退出登陆失败！');
    })
  }

  return (
    <>
        <h5>{name}</h5>
        <button onClick={onGoPage}>跳转</button>
        <button onClick={onLoginOut}>退出登录</button>
    </>
  )
}
